package org.jallinone.sqltool.java;

import org.openswing.swing.message.receive.java.*;


/**
 * <p>Title: JAllInOne ERP/CRM application</p> <p>Description: Value object used to define a table column info.</p> <p>Copyright: Copyright (C) 2006 Mauro Carniel</p> <p> This file is part of JAllInOne ERP/CRM application. This application is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it</p>
 * @author  Mauro Carniel
 * @version  1.0
 */
public class ColumnVO extends ValueObjectImpl {


  private String columnType;
  private java.math.BigDecimal columnSize;
  private java.math.BigDecimal columnDec;
  private int columnSqlType;
  private String columnName;
  private String attributeName;
  private String columnHeaderName;
  private boolean columnRequired;
  private java.util.ArrayList columnValues;
  private Object defaultValue;
  private boolean columnVisible;
  /**
 * @uml.property  name="tableVO"
 * @uml.associationEnd  
 */
private TableVO tableVO = null;

  /** indicate is the current column must be calculated as a progressive */
  private boolean progressive;

  
  public ColumnVO() {}

  
  public ColumnVO(TableVO tableVO) {
    this.tableVO = tableVO;
  }


  /**
 * @return
 * @uml.property  name="columnName"
 */
public String getColumnName() {
    return columnName;
  }

  public String getColumnNameWithoutTable() {
    try {
      return columnName.substring(columnName.indexOf(".") + 1);
    }
    catch (Exception ex) {
      return columnName;
    }
  }


  /**
 * @param columnName
 * @uml.property  name="columnName"
 */
public void setColumnName(String columnName) {
    this.columnName = columnName;
  }
  /**
 * @return
 * @uml.property  name="columnType"
 */
public String getColumnType() {
    return columnType;
  }
  /**
 * @param columnType
 * @uml.property  name="columnType"
 */
public void setColumnType(String columnType) {
    this.columnType = columnType;
  }
  /**
 * @return
 * @uml.property  name="columnSize"
 */
public java.math.BigDecimal getColumnSize() {
    return columnSize;
  }
  /**
 * @param columnSize
 * @uml.property  name="columnSize"
 */
public void setColumnSize(java.math.BigDecimal columnSize) {
    this.columnSize = columnSize;
  }
  /**
 * @return
 * @uml.property  name="columnDec"
 */
public java.math.BigDecimal getColumnDec() {
    return columnDec;
  }
  /**
 * @param columnDec
 * @uml.property  name="columnDec"
 */
public void setColumnDec(java.math.BigDecimal columnDec) {
    this.columnDec = columnDec;
  }
  /**
 * @return
 * @uml.property  name="attributeName"
 */
public String getAttributeName() {
    return attributeName;
  }
  /**
 * @param attributeName
 * @uml.property  name="attributeName"
 */
public void setAttributeName(String attributeName) {
    this.attributeName = attributeName;
  }
  /**
 * @return
 * @uml.property  name="columnHeaderName"
 */
public String getColumnHeaderName() {
    return columnHeaderName;
  }
  /**
 * @param columnHeaderName
 * @uml.property  name="columnHeaderName"
 */
public void setColumnHeaderName(String columnHeaderName) {
    this.columnHeaderName = columnHeaderName;
  }
  /**
 * @return
 * @uml.property  name="columnRequired"
 */
public boolean getColumnRequired() {
    return columnRequired;
  }
  /**
 * @param columnRequired
 * @uml.property  name="columnRequired"
 */
public void setColumnRequired(boolean columnRequired) {
    this.columnRequired = columnRequired;
  }
  /**
 * @return
 * @uml.property  name="columnValues"
 */
public java.util.ArrayList getColumnValues() {
    return columnValues;
  }
  /**
 * @param columnValues
 * @uml.property  name="columnValues"
 */
public void setColumnValues(java.util.ArrayList columnValues) {
    this.columnValues = columnValues;
  }
  /**
 * @return
 * @uml.property  name="defaultValue"
 */
public Object getDefaultValue() {
    return defaultValue;
  }
  /**
 * @param defaultValue
 * @uml.property  name="defaultValue"
 */
public void setDefaultValue(Object defaultValue) {
    this.defaultValue = defaultValue;
  }
  /**
 * @return
 * @uml.property  name="columnVisible"
 */
public boolean getColumnVisible() {
    return columnVisible;
  }
  /**
 * @param columnVisible
 * @uml.property  name="columnVisible"
 */
public void setColumnVisible(boolean columnVisible) {
    this.columnVisible = columnVisible;
  }
  /**
 * @return
 * @uml.property  name="columnSqlType"
 */
public int getColumnSqlType() {
    return columnSqlType;
  }
  /**
 * @param columnSqlType
 * @uml.property  name="columnSqlType"
 */
public void setColumnSqlType(int columnSqlType) {
    this.columnSqlType = columnSqlType;
  }


  public boolean getPrimaryKey() {
	  return tableVO.isPrimaryKey(columnName);
  }
  /**
 * @return
 * @uml.property  name="progressive"
 */
public boolean getProgressive() {
	  return progressive;
  }
  /**
 * @param progressive
 * @uml.property  name="progressive"
 */
public void setProgressive(boolean progressive) {
	  this.progressive = progressive;
  }


  /**
 * @param tableVO
 * @uml.property  name="tableVO"
 */
public void setTableVO(TableVO tableVO) {
	  this.tableVO = tableVO;
  }


  
  
}
